package com.jack.leetcode.eachproblem_2020;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhang_j on 2020/11/12
 */
public class 找到所有数组中消失的数字 {

    public List<Integer> findDisappearedNumbers(int[] nums) {
        int n = nums.length;
        boolean[] dp = new boolean[n + 1];
        for(int i = 0;i < n;i++){
            dp[nums[i]] = true;
        }
        List<Integer> result = new ArrayList<>();
        for(int i = 1;i <= n;i++){
            if(!dp[i]){
                result.add(i);
            }
        }
        return result;
    }
}
